'use strict'

const Service = require('egg').Service

class PayType extends Service {
  async list (id) {
    const { ctx, app } = this
    const QUERY_STR = 'id, pay_type, amount, date, type_id, type_name, remark'
    const sql = `select * from type where user_id = ${id} or user_id = 0`

    try {
      const result = await app.mysql.query(sql)
      return result
    } catch (error) {
      console.log(error)
      return null
    }
  }
}

module.exports = PayType
